package com.xnyzc.lhy.finance.service.impl.invoice;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xnyzc.lhy.finance.entity.invoice.OaSysInvoiceStrategy;
import com.xnyzc.lhy.finance.mapper.invoice.OaSysInvoiceStrategyMapper;
import com.xnyzc.lhy.finance.service.invoice.IOaSysInvoiceStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author haoyfa
 * @since 2019-10-31
 */
@Service
public class OaSysInvoiceStrategyServiceImpl extends ServiceImpl<OaSysInvoiceStrategyMapper, OaSysInvoiceStrategy> implements IOaSysInvoiceStrategyService {

    @Autowired
    OaSysInvoiceStrategyMapper oaSysInvoiceStrategyMapper;
    /**
     * 获得默认的开票策略
     * @return
     */
    @Override
    public OaSysInvoiceStrategy selectDefaultOaSysInvoiceStrategy() {
        try {
            //获取审核状态字典
            QueryWrapper queryWrapper=new QueryWrapper();

            queryWrapper.eq(OaSysInvoiceStrategy.IS_START, true);

            OaSysInvoiceStrategy oaSysInvoiceStrategy = oaSysInvoiceStrategyMapper.selectOne(queryWrapper);
            return oaSysInvoiceStrategy;
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
}
